<h3><%= t(".title", username: @user.username) %></h3>
<table class="table table-striped">
  <tr>
    <th><%= User.human_attribute_name(:username) %></th>
    <td><%= @user.username %></td>
  </tr>
  <tr>
    <th><%= User.human_attribute_name(:email) %></th>
    <td><%= @user.email %></td>
  </tr>
  <% unless @user.approved? %>
    <tr>
      <th><%= User.human_attribute_name(:approved) %></th>
      <td>
        <%= link_to safe_join([Icon(icon: "person-check", label: t(".approve")), t(".approve")], " "), settings_user_path(@user, approve: true), method: :patch, class: "btn btn-primary btn-sm" if policy(@user).edit? %>
      </td>
    </tr>
  <% end %>
  <tr>
    <th><%= User.human_attribute_name(:created_at) %></th>
    <td><%= @user.created_at.to_fs(:long) %></td>
  </tr>
  <tr>
    <th><%= User.human_attribute_name(:updated_at) %></th>
    <td><%= @user.updated_at.to_fs(:long) %></td>
  </tr>
  <tr>
    <th><%= t("settings.users.quota.current_space_used") %></th>
    <td><%= @user.current_space_used.to_fs(:human_size, precision: 2) %></td>
  </tr>
  <% if SiteSettings.enable_user_quota %>
    <tr>
      <th><%= t("settings.users.quota.using_site_default") %></th>
      <td><%= @user.quota_use_site_default? ? "✅" : "❌" %></td>
    </tr>
    <tr>
      <th><%= t("settings.users.quota.title") %></th>
      <td><%= @user.has_quota? ? @user.quota.to_fs(:human_size) : t("settings.users.quota.unlimited_quota") %></td>
    </tr>
  <% end %>
  <tr>
    <th><%= User.human_attribute_name(:interface_language) %></th>
    <td><%= @user.interface_language.present? ? I18nData.languages(@user.interface_language)[@user.interface_language.to_s.first(2).upcase.to_s]&.capitalize : t("devise.registrations.general_settings.interface_language.autodetect") %></td>
  </tr>
  <% if SiteSettings.oidc_enabled? %>
    <tr>
      <th><%= User.human_attribute_name(:auth_uid) %></th>
      <td><%= (@user.auth_uid ? "✅" : "❌") %></td>
    </tr>
  <% end %>
  <% if SiteSettings.federation_enabled? %>
    <tr>
      <th><%= t("settings.users.index.fediverse_address") %></th>
      <td><%= @user.federails_actor.at_address %></td>
    </tr>
  <% else %>
    <tr>
      <th><%= User.human_attribute_name(:public_id) %></th>
      <td><%= @user.public_id %></td>
    </tr>
  <% end %>
  <tr>
    <th><%= User.human_attribute_name(:roles) %></th>
    <td><%= @user.roles.map(&:name).join(", ") %></td>
  </tr>
</table>

<%= link_to safe_join([Icon(icon: "pencil", label: t("general.edit")), t("general.edit")], " "), edit_settings_user_path(@user), class: "btn btn-primary" if policy(@user).edit? %>
<%= link_to safe_join([Icon(icon: "key", label: t(".reset_password")), t(".reset_password")], " "), settings_user_path(@user, reset: true), method: :patch, class: "btn btn-warning" if policy(@user).edit? %>
<%= link_to safe_join([Icon(icon: "trash", label: t("general.delete")), t("general.delete")], " "), settings_user_path(@user), {method: :delete, class: "float-end btn btn-outline-danger", data: {confirm: translate(".confirm_destroy")}} if policy(@user).destroy? && @user != current_user %>
